home *** CD-ROM | disk | FTP | other *** search
/ Clickx 47 / Clickx 47.iso / assets / software / Miro_Installer.exe / xulrunner / python / compiled_templates / download_item_inner.py < prev    next >
Encoding:
Python Source  |  2008-01-10  |  28.9 KB  |  330 lines

  1. # This is a generated file. Do not edit.
  2. from template import Handle, fillAttr, quoteAndFillAttr, fillStaticTemplate
  3. from StringIO import StringIO
  4. from xhtmltools import urlencode
  5. from templatehelper import quoteattr, escape
  6. from string import Template
  7. import app
  8. import views
  9. import sorts
  10. import indexes
  11. import filters
  12. import resources
  13. import gtcache
  14. _ = gtcache.gettext
  15. def fillTemplate(domHandler, dtvPlatform, eventCookie, bodyTagExtra, *args, **kargs):
  16.     # Start of handle
  17.  
  18.     # Start user code
  19.     
  20.     # Allows this template to be viewed when not included in another
  21.     # template's view
  22.     this = kargs['this']
  23.     viewName = kargs['viewName']
  24.              
  25.     # End user code
  26.  
  27.     localvars = locals()
  28.     localvars.update(globals())
  29.     handle = Handle(domHandler, localvars, onUnlink = lambda:None)
  30.  
  31.     # Start of handle
  32.  
  33.     # Start user code
  34.     # End user code
  35.  
  36.     localvars = locals()
  37.     localvars.update(globals())
  38.     handle_0 = Handle(domHandler, localvars, onUnlink = lambda:None)
  39.  
  40.     handle.addSubHandle(handle_0)
  41.     # Start of handle
  42.  
  43.     # Start user code
  44.     # End user code
  45.  
  46.     localvars = locals()
  47.     localvars.update(globals())
  48.     handle_1 = Handle(domHandler, localvars, onUnlink = lambda:None)
  49.  
  50.     handle.addSubHandle(handle_1)
  51.     # Start of handle
  52.  
  53.     # Start user code
  54.     # End user code
  55.  
  56.     localvars = locals()
  57.     localvars.update(globals())
  58.     handle_2 = Handle(domHandler, localvars, onUnlink = lambda:None)
  59.  
  60.     handle.addSubHandle(handle_2)
  61.  
  62.  
  63.     out = StringIO()
  64.     out.write(u"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n")
  65.     out.write(u'<html dtvPlatform="')
  66.     out.write(quoteattr(urlencode(dtvPlatform)))
  67.     out.write(u'" eventCookie="')
  68.     out.write(quoteattr(urlencode(eventCookie)))
  69.     out.write(u'" xmlns:t="http://www.participatorypolitics.org/" xmlns="http://www.w3.org/1999/xhtml" xmlns:i18n="http://www.participatoryculture.org/i18n">\n    <head>\n        <meta content="text/html; charset=utf-8" http-equiv="content-type"></meta>\n        <script type="text/javascript">\n<!-- // Protect from our XML parser, which doesn\'t know to protect <script>\n\n///////////////////////////////////////////////////////////////////////////////\n//// For use on your page                                                  ////\n///////////////////////////////////////////////////////////////////////////////\n\nfunction getDTVPlatform() {\n    var elt = document.getElementsByTagName("html")[0];\n    return elt.getAttribute(\'dtvPlatform\');\n}\n\nfunction loadURL(url) {\n    try {\n        document.location.href = url;\n    } catch (e) {\n        // This may happen if the backend decides to handle the url load\n        // itself.\n    }\n}\n\n// For calling from page Javascript: Cause a URL to be loaded. The\n// assumption is that the application will notice, abort the load, and\n// take some action based on the URL.\nfunction eventURL(url) {\n    if (typeof(window.frontend) == \'undefined\') {\n\t// Generic strategy: trigger a load, and hope the application\n\t// catches it and cancels it without creating a race\n\t// condition.\n        loadURL(url)\n    } else {\n\t// OS X WebKit (KHTML) strategy: pass in an Objective C object\n\t// through the window object and call a method on it.\n\twindow.frontend.eventURL(url);\n    }\n\n    return false;\n}\n\n// Calls eventURL, then calls event.stopPropagation() and\n// event.preventDefault() so that the event chain is stopped.\nfunction eventURLAndStop(url, event) {\n  eventURL(url);\n  event.stopPropagation();\n  event.preventDefault();\n}\n\nfunction recommendItem(title, url) {\n    loadURL(\'http://www.videobomb.com/index/democracyemail?url=\' + \n            url + \'&title=\' + title);\n    return false;\n}\n\nfunction recommendChannel(title, url) {\n    // See also app.py if changing this URL\n    loadURL(\'http://www.videobomb.com/democracy_channel/email_friend\' +\n        \'?url=\' + url + \'&title=\' + title);\n    return false;\n}\n\n// Start the video player. The playlist will be the items in the view\n// named by viewName. If firstItemId is the id of an item in the view,\n// playback will start on that item; otherwise playback will start on\n// the first item.\nfunction playViewNamed(viewName, firstItemId) {\n    url = \'action:playViewNamed?\';\n    url = url + \'viewName=\' + URLencode(viewName);\n    url = url + \'&firstItemId=\' + URLencode(firstItemId);\n    eventURL(url);\n    return false;\n}\n\n// You can make \'incremental search\' text boxes on your page that\n// effectively tie the text box to the \'parameter\' argument of setViewFilter,\n// with the other argumens fixed. To do this, add these two attributes to\n// the text box:\n//   onfocus="startEditSearch(this)"\n//   onblur="endEditFilter()"\n// replacing the arguments in parentheses with the desired strings.\n//\n// You\'ll also need to provide a updateSearchString function at the\n// top of your template to perform the actual update\n\nvar editSearchField = null;\nvar editSearchOldValue = \'\';\nvar editSearchTimer = null;\nvar editSearchCallback = null;\n\nfunction onSearchFocus(obj){\n  if (obj.getAttribute(\'searching\') != \'1\') {\n\tobj.value="";\n\tobj.searching = \'1\';\n  }\n  startEditSearch(obj, null);\n}\n\nfunction startEditSearch(obj, callback) {\n  editSearchOldValue = obj.value;\n\n  editSearchField = obj;\n  editSearchCallback = callback;\n  editSearchTimerTick();\n}\n\nfunction editSearchUpdate() {\n    value = editSearchField.value;\n    if (editSearchOldValue != value) {\n\turl = \'action:setSearchString?searchString=\' + URLencode(value);\n\teventURL(url);\n\teditSearchOldValue = value;\n\tif(editSearchCallback) editSearchCallback();\n    }\n}\n\nfunction editSearchTimerTick() {\n    editSearchUpdate();\n    editSearchTimer = setTimeout(editSearchTimerTick, 50);\n}\n\nfunction endEditSearch() {\n  clearTimeout(editSearchTimer);\n  editSearchUpdate();\n}\n\n// Internal use: \'URL encode\' the given string.\nfunction URLencode(str) {\n    return encodeURIComponent(str)\n}\n\nfunction URLdecode(str) {\n  return decodeURIComponent(str)\n}\n\nvar currentSelectBoxMenu = null;\nfunction showSelectBoxMenu(id) {\n    document.getElementById(id).style.display = \'block\';\n    currentSelectBoxMenu = id;\n    document.addEventListener(\'click\', hideSelectBoxMenu, true)\n}\n\nfunction hideSelectBoxMenu(event) {\n    document.getElementById(currentSelectBoxMenu).style.display = \'\';\n    currentSelectBoxMenu = null;\n    document.removeEventListener(\'click\', hideSelectBoxMenu, true)\n}\n\n///////////////////////////////////////////////////////////////////////////////\n//// For calling by host templating code                                   ////\n///////////////////////////////////////////////////////////////////////////////\n\n// For calling by host templating code: Set CSS styles on the item\n// with the given ID to make it disappear.\nfunction hideItem(id) {\n    elt = document.getElementById(id);\n    elt.style.display = \'none\';\n    forceRedisplay(elt);\n}\n\n// For calling by host templating code: Set CSS styles on the item\n// with the given ID to make it visible if it was previously hidden.\nfunction showItem(id) {\n    elt = document.getElementById(id);\n    elt.style.display = \'\';\n    forceRedisplay(elt);\n}\n\n// For calling by host templating code: Replace the item with the\n// given id with the element described by the proided XML.\nfunction changeItem(id, newXML) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.parentNode.replaceChild(frag, elt);\n}\n\n// For calling by host templating code: Parse the XML in newXML into a\n// new element, and insert the new element immediately before the item\n// with the given id, such that the newly inserted item has the same\n// parent.\nfunction addItemBefore(newXML, id) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.parentNode.insertBefore(frag, elt);\n}    \n\n// For calling by host templating code: Parse the XML in newXML into a\n// new element, and insert the new element as the final child of the\n// item with the given id.\nfunction addItemAtEnd(newXML, id) {\n    elt = document.getElementById(id);\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.createContextualFragment(newXML);\n    elt.insertBefore(frag, null);\n}    \n\n// For calling by host templating code: Remove the item with the given\n// id.\nfunction removeItem(id) {\n    elt = document.getElementById(id);\n    elt.parentNode.removeChild(elt);\n}    \n\n// Internal use: Sometime if all you do is change the style on a node,\n// Safari doesn\'t update the view until your mouse is next over the\n// window. Force the issue by making a drastic change in the vicinity\n// of the given element and then reversing it.\nfunction forceRedisplay(elt) {\n    r = document.createRange();\n    r.selectNode(elt);\n    frag = r.extractContents();\n    r.insertNode(frag);\n}\n\nfunction handleContextMenuSelect(event) {\n  if(event.button == 2) {\n    var area = event.currentTarget.getAttribute("selectArea");\n    var id = event.currentTarget.getAttribute("selectID");\n    var viewName = event.currentTarget.getAttribute("selectViewName");\n    var url = \'action:handleContextMenuSelect?id=\' + id + \'&area=\' + area +\n              \'&viewName=\' + viewName;\n    eventURL(url);\n  }\n  return true;\n}\n\nfunction handleSelect(event) {\n   if(event.target.tagName && event.target.tagName.toUpperCase() == \'A\') {\n       // Either a link in the descrption, or a bomb/mailto/trash click\n       return true;\n    }\n    var id = event.currentTarget.getAttribute("selectID");\n    var viewName = event.currentTarget.getAttribute("selectViewName");\n    var area = event.currentTarget.getAttribute("selectArea");\n    var shiftKey = \'0\';\n    var ctrlKey = \'0\';\n    if(event.shiftKey) shiftKey = \'1\';\n    if(event.ctrlKey || event.metaKey) ctrlKey = \'1\';\n    eventURL(\'action:handleSelect?area=\' + area + \'&viewName=\' + viewName + \n\t\'&id=\' + id + \'&shiftDown=\' + shiftKey + \'&ctrlDown=\' + ctrlKey);\n    return true;\n}\n\nfunction handleDblClick(event, viewName, id) {\n   var target = event.target;\n   while (target != undefined && target.ondblclick === null && target.tagName.toUpperCase() != \'A\') {\n       target = target.parentNode;\n   }\n\n   if(target.tagName.toUpperCase() == \'A\') {\n       // Either a link in the descrption, or a bomb/mailto/trash click\n       return true;\n   } else {\n       return eventURL(\'action:playViewNamed?viewName=\' + viewName + \n           \'&firstItemId=\' + id);\n   }\n}\n\nfunction getKeyFromEvent(evt) {\n  var key = 0;\n  if (window.event)  {\n    key = evt.keyCode;\n  } else if (evt.which) {\n  \tkey = evt.which;\n  }\n\n  return key;\n}\n\nfunction sendKeyToSearchBox(event) {\n  if(event.altKey || event.ctrlKey || event.metaKey ||\n      (event.target.tagName && event.target.tagName.toUpperCase() == \'INPUT\'))\n      return true;\n  var key = getKeyFromEvent(event);\n  if ((key == 33) || (key == 34) || (key == 35) || (key == 36) || \n      (key == 37) || (key == 38) || (key == 39) || (key == 40))\n      return true;\n  var searchBox = document.getElementById("search-box");\n  searchBox.focus();\n  return true;\n}\n\nfunction playNewVideos(event, id) {\n  eventURL(\'action:playNewVideos?id=\' + id);\n  event.stopPropagation(); // don\'t want handleSelect to deal with this event\n  return false;\n}\n\n///////////////////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////////////////\n\n-->\n</script>\n\n        \n    </head>\n    <body')
  70.     out.write(u" " + bodyTagExtra)
  71.     out.write(u'>\n        <div class="dnd-reorder-line"></div>\n        ')
  72.     out.write(u'\n    <img src="')
  73.     out.write(quoteattr(this.getThumbnail()))
  74.     out.write(u'" alt="" class="main-video-tnail" id="video-tnail-')
  75.     out.write(quoteattr(viewName + str(this.getID())))
  76.     out.write(u'"></img>\n\n    <div class="main-video-hitbox">\n        ')
  77.     if not (not (this.isDownloadable())):
  78.         out.write(u'<a href="#" class="icon download" onclick="return eventURL(\'action:startDownload?item=')
  79.         out.write(quoteattr(urlencode(this.getID())))
  80.         out.write(u'\');" title="Download \'')
  81.         out.write(quoteattr(this.getTitle()))
  82.         out.write(u'\'"></a>')
  83.     out.write(u'\n        ')
  84.     if not (not (this.getState() == 'paused')):
  85.         out.write(u'<a href="#" class="icon paused-circle" onclick="return eventURL(\'action:startDownload?item=')
  86.         out.write(quoteattr(urlencode(this.getID())))
  87.         out.write(u'\');" title="Download \'')
  88.         out.write(quoteattr(this.getTitle()))
  89.         out.write(u'\'"></a>')
  90.     out.write(u'\n        ')
  91.     if not (not (this.getState() == 'downloading')):
  92.         out.write(u'<span class="icon inprogress-background">\n            ')
  93.         if not (this.isPendingManualDownload()):
  94.             out.write(u'<img src="')
  95.             out.write(quoteattr(resources.url(u'images/main-video-inprogress-arrows.gif')))
  96.             out.write(u'" title="Downloading \'')
  97.             out.write(quoteattr(this.getTitle()))
  98.             out.write(u'\'" class="inprogress-arrows"></img>')
  99.         out.write(u'\n            ')
  100.         if not (not (this.isPendingManualDownload())):
  101.             out.write(u'<img src="')
  102.             out.write(quoteattr(resources.url(u'images/download-pending-dot.png')))
  103.             out.write(u'" class="download-pending-icon" title="Download Pending for \'')
  104.             out.write(quoteattr(this.getTitle()))
  105.             out.write(u'\'"></img>')
  106.         out.write(u'\n        </span>')
  107.     out.write(u'\n        ')
  108.     if not (not (this.isPlayable())):
  109.         out.write(u'<a href="#" class="icon play" onclick="return eventURL(\'action:playViewNamed?viewName=')
  110.         out.write(quoteattr(urlencode(viewName)))
  111.         out.write(u'&firstItemId=')
  112.         out.write(quoteattr(urlencode(this.getID())))
  113.         out.write(u'\');" title="Play \'')
  114.         out.write(quoteattr(this.getTitle()))
  115.         out.write(u'\'"></a>')
  116.     out.write(u'\n    </div>\n')
  117.     out.write(u'\n        ')
  118.     out.write(u'\n    <div class="main-video-details">\n        <div class="main-video-details-top">\n            <div class="details-link">\n                ')
  119.     if not (this.showMoreInfo):
  120.         out.write(u'<div>\n                    <a href="#" onclick="return eventURL(\'action:toggleMoreItemInfo?item=')
  121.         out.write(quoteattr(urlencode(this.getID())))
  122.         out.write(u'\');"><span>')
  123.         out.write(_(u'Details'))
  124.         out.write(u'</span> <img src="')
  125.         out.write(quoteattr(resources.url(u'images/more-info-button.png')))
  126.         out.write(u'" alt=""></img></a>\n                </div>')
  127.     out.write(u'\n\n                ')
  128.     if not (not (this.showMoreInfo)):
  129.         out.write(u'<div>\n                    <a href="#" onclick="return eventURL(\'action:toggleMoreItemInfo?item=')
  130.         out.write(quoteattr(urlencode(this.getID())))
  131.         out.write(u'\');"><span>')
  132.         out.write(_(u'Close'))
  133.         out.write(u'</span> <img src="')
  134.         out.write(quoteattr(resources.url(u'images/more-info-button-close.png')))
  135.         out.write(u'" alt=""></img></a>\n                </div>')
  136.     out.write(u'\n            </div>\n            <div class="video-stats">\n                <div class="length">\n                    <span>')
  137.     out.write(escape(this.getDuration()))
  138.     out.write(u'</span>\n                </div>\n                <div class="date">\n                    ')
  139.     if not (not (this.getReleaseDate() != '')):
  140.         out.write(u'<span><span>')
  141.         out.write(escape(this.getReleaseDate()))
  142.         out.write(u'</span></span>')
  143.     out.write(u'\n                </div>\n\n                <div class="size">\n                    ')
  144.     if not (not ((this.getURL() != this.getLink() and this.getLink() != '') or this.isDownloaded())):
  145.         out.write(u'<span><span>')
  146.         out.write(escape(this.getSizeForDisplay()))
  147.         out.write(u'</span></span>')
  148.     out.write(u'\n                </div>\n                <div class="torrent">\n                    ')
  149.     if not (not (this.looksLikeTorrent())):
  150.         out.write(u'<span>\n                        <span>')
  151.         out.write(_(u'.torrent'))
  152.         out.write(u'</span>\n                    </span>')
  153.     out.write(u'\n                </div>\n           </div>\n        </div>\n\n        <div class="main-video-details-main">\n            <div class="details-buttons-right">\n                <div class="save-button-container">\n                    ')
  154.     if not (not (this.showSaveButton())):
  155.         out.write(u'<div>\n                        <a href="#" class="round-button-left save" onclick="return eventURL(\'action:keepItem?item=')
  156.         out.write(quoteattr(urlencode(this.getID())))
  157.         out.write(u'\');">\n                        <div class="round-button-right">\n                        <div class="round-button-content">\n                            <span>')
  158.         out.write(_(u'KEEP'))
  159.         out.write(u'</span>\n                        </div>\n                        </div>\n                        </a>\n                    </div>')
  160.     out.write(u'\n                    ')
  161.     if not (not (this.showSaved())):
  162.         out.write(u'<div class="saved-note">SAVED</div>')
  163.     out.write(u'\n                </div>\n                ')
  164.     if not (not (this.showTrashButton())):
  165.         out.write(u'<div>\n                    <a href="#" class="round-button-left delete" onclick="return eventURL(\'action:expireItem?item=')
  166.         out.write(quoteattr(urlencode(this.getID())))
  167.         out.write(u'\');">\n                    <div class="round-button-right">\n                    <div class="round-button-content">\n                        <span>')
  168.         out.write(_(u'DELETE'))
  169.         out.write(u'</span>\n                    </div>\n                    </div>\n                    </a>\n                </div>')
  170.     out.write(u'\n            </div>\n\n            \n            ')
  171.     if not (not (this.hasSharableURL())):
  172.         out.write(u'<div class="select-box-left share-box" onclick="showSelectBoxMenu(\'share-menu-')
  173.         out.write(quoteattr(urlencode(viewName)))
  174.         out.write(u'-')
  175.         out.write(quoteattr(urlencode(this.getID())))
  176.         out.write(u'\'); event.stopPropagation();">\n                <div class="select-box-right">\n                    <div class="select-box-mid">\n                        SHARE\n                    </div>\n                </div>\n            </div>')
  177.     out.write(u'\n            <br class="clear"></br>\n            <ul id="share-menu-')
  178.     out.write(quoteattr(urlencode(viewName)))
  179.     out.write(u'-')
  180.     out.write(quoteattr(urlencode(this.getID())))
  181.     out.write(u'" class="select-box-menu share-menu">\n                <li>\n                    <a href="#" class="main-video-details-task-mail" onclick="return recommendItem(\'')
  182.     out.write(quoteattr(urlencode(this.getTitle())))
  183.     out.write(u"', '")
  184.     out.write(quoteattr(urlencode(this.getURL())))
  185.     out.write(u"', '")
  186.     out.write(quoteattr(urlencode(this.getFeed().getURL())))
  187.     out.write(u'\');">\n                        <img src="')
  188.     out.write(quoteattr(resources.url(u'images/email-a-friend.gif')))
  189.     out.write(u'" alt="email-a-friend icon"></img>\n                        <span>')
  190.     out.write(_(u'Email to a friend'))
  191.     out.write(u'</span>\n                    </a>\n                </li>\n                <li>\n                    <a href="#" class="main-video-details-task-bomb" onclick="return eventURL(\'action:videoBombExternally?item=')
  192.     out.write(quoteattr(urlencode(this.getID())))
  193.     out.write(u'\');">\n                        <img src="')
  194.     out.write(quoteattr(resources.url(u'images/videobomb.gif')))
  195.     out.write(u'" alt="videobomb icon"></img>\n                        <span>')
  196.     out.write(_(u'Post to Video Bomb'))
  197.     out.write(u'</span>\n                    </a>\n                </li>\n                <li>\n                    <a href="#" class="main-video-details-delicious" onclick="return eventURL(\'http://del.icio.us/post?v=4&noui&jump=close&url=')
  198.     out.write(quoteattr(urlencode(this.getURL())))
  199.     out.write(u'&title=')
  200.     out.write(quoteattr(urlencode(this.getTitle())))
  201.     out.write(u'\');">\n                        <img src="')
  202.     out.write(quoteattr(resources.url(u'images/delicious.gif')))
  203.     out.write(u'" alt="delicious icon"></img>\n                        <span>')
  204.     out.write(_(u'Post to del.icio.us'))
  205.     out.write(u'</span>\n                    </a>\n                </li>\n                <li>\n                    <a href="#" class="main-video-details-digg" onclick="return eventURL(\'http://www.digg.com/submit?phrase=2&url=')
  206.     out.write(quoteattr(urlencode(this.getQuotedURL())))
  207.     out.write(u'\');">\n                        <img src="')
  208.     out.write(quoteattr(resources.url(u'images/digg.gif')))
  209.     out.write(u'" alt="digg icon"></img>\n                        <span>')
  210.     out.write(_(u'Post to digg'))
  211.     out.write(u'</span>\n                    </a>\n                </li>\n                <li>\n                    <a href="#" class="main-video-details-reddit" onclick="return eventURL(\'http://reddit.com/submit?url=')
  212.     out.write(quoteattr(urlencode(this.getQuotedURL())))
  213.     out.write(u'&title=')
  214.     out.write(quoteattr(urlencode(this.getQuotedTitle())))
  215.     out.write(u'\');">\n                        <img src="')
  216.     out.write(quoteattr(resources.url(u'images/reddit.gif')))
  217.     out.write(u'" alt="reddit icon"></img>\n                        <span>')
  218.     out.write(_(u'Post to Reddit'))
  219.     out.write(u'</span>\n                    </a>\n                </li>\n            </ul>\n            <!-- HOT SPOT download-progress-')
  220.     out.write(quoteattr(viewName))
  221.     out.write(u'-')
  222.     out.write(quoteattr(this.getID()))
  223.     out.write(u' --><div id="download-progress-')
  224.     out.write(quoteattr(viewName))
  225.     out.write(u'-')
  226.     out.write(quoteattr(this.getID()))
  227.     out.write(u'">\n                ')
  228.     if not (not (this.getState() in ('downloading','paused'))):
  229.         out.write(u'<div class="main-video-details-download-info">\n                    ')
  230.         if not (not (this.gotContentLength())):
  231.             out.write(u'<div>\n                        <div class="main-progress-bar-bg">\n                            <div style="width: ')
  232.             out.write(quoteattr(this.downloadProgressWidth()))
  233.             out.write(u'px;" class="main-progress-bar"></div>\n                        </div>\n                    </div>')
  234.         out.write(u'\n                    ')
  235.         if not (this.gotContentLength()):
  236.             out.write(u'<div>\n                        <div class="progress-throbber-bg">\n                            ')
  237.             if not (not (this.downloadRate() != '0KB/s')):
  238.                 out.write(u'<span>\n                                <img src="')
  239.                 out.write(quoteattr(resources.url(u'images/progress-throbber.gif')))
  240.                 out.write(u'"></img>\n                            </span>')
  241.             out.write(u'\n                            ')
  242.             if not (not (this.downloadRate() == '0KB/s')):
  243.                 out.write(u'<span>\n                                <img src="')
  244.                 out.write(quoteattr(resources.url(u'images/progress-throbber-gray.png')))
  245.                 out.write(u'"></img>\n                            </span>')
  246.             out.write(u'\n                        </div>\n                    </div>')
  247.         out.write(u'\n                    ')
  248.         if not (not (this.getState() == 'downloading')):
  249.             out.write(u'<div class="downloading">\n                        ')
  250.             if not (not (this.downloadInProgress())):
  251.                 out.write(u'<div class="download-rate-and-eta">\n                            <span class="download-rate">')
  252.                 out.write(escape(this.downloadRate()))
  253.                 out.write(u'</span>\n                            <span>')
  254.                 out.write(escape(this.downloadETA()))
  255.                 out.write(u'</span>\n                        </div>')
  256.             out.write(u'\n                        ')
  257.             if not (this.downloadInProgress()):
  258.                 out.write(u'<div>\n                            <span>')
  259.                 out.write(escape(this.getStartupActivity()))
  260.                 out.write(u'</span>\n                        </div>')
  261.             out.write(u'\n                    </div>')
  262.         out.write(u'\n                    ')
  263.         if not (not (this.getState() == 'paused')):
  264.             out.write(u'<div class="paused">\n                        <span>')
  265.             out.write(escape(this.getPausedString()))
  266.             out.write(u'</span>\n                    </div>')
  267.         out.write(u'\n                    ')
  268.         if not (this.getState() == 'paused'):
  269.             out.write(u'<a title="Pause Download" href="#" class="main-progress-pause" onclick="return eventURL(\'action:pauseDownload?item=')
  270.             out.write(quoteattr(urlencode(this.getID())))
  271.             out.write(u'\');"></a>')
  272.         out.write(u'\n                    ')
  273.         if not (not (this.getState() == 'paused')):
  274.             out.write(u'<a href="#" class="main-progress-resume" onclick="return eventURL(\'action:resumeDownload?item=')
  275.             out.write(quoteattr(urlencode(this.getID())))
  276.             out.write(u'\');" title="Pause Download"></a>')
  277.         out.write(u'\n                    <a href="#" class="main-progress-cancel" onclick="return eventURL(\'action:expireItem?item=')
  278.         out.write(quoteattr(urlencode(this.getID())))
  279.         out.write(u'\');" title="Cancel Download"></a>\n                </div>')
  280.     out.write(u'\n            </div><!-- HOT SPOT END -->\n            <div class="download-status-strings">\n                ')
  281.     if not (not (this.getExpiring())):
  282.         out.write(u'<div class="main-video-details-expiring">\n                    <span>')
  283.         out.write(escape(this.getExpirationString()))
  284.         out.write(u'</span>\n                </div>')
  285.     out.write(u'\n                ')
  286.     if not (not (this.isPendingAutoDownload())):
  287.         out.write(u'<div class="main-video-details-pending-auto">\n                    <span>')
  288.         out.write(_(u'Pending Auto Download'))
  289.         out.write(u'</span>\n                </div>')
  290.     out.write(u'\n                ')
  291.     if not (not (this.isFailedDownload() and not this.isPendingManualDownload())):
  292.         out.write(u'<div class="main-video-details-failed-download">\n                    <span>')
  293.         out.write(escape(this.getFailureReason()))
  294.         out.write(u'</span>\n                </div>')
  295.     out.write(u'\n            </div>\n            ')
  296.     if not (this.getEmblemCSSString() == ''):
  297.         out.write(u'<div class="video-state ')
  298.         out.write(quoteattr(this.getEmblemCSSClass()))
  299.         out.write(u'">\n                <div class="video-state-left">\n                    <div class="video-state-right">\n                        <span class="video-state-mid">\n                            <span>')
  300.         out.write(escape(this.getEmblemCSSString()))
  301.         out.write(u'</span>\n                        </span>\n                    </div>\n                </div>\n            </div>')
  302.     out.write(u'\n            ')
  303.     if not (not (this.downloader and this.downloader.getState() == 'uploading')):
  304.         out.write(u'<div>\n                 <a href="#" class="round-button-left stop-seeding" onclick="return eventURL(\'action:stopUploadItem?item=')
  305.         out.write(quoteattr(urlencode(this.getID())))
  306.         out.write(u'\');">\n                <div class="round-button-right">\n                <div class="round-button-content">\n                    <span>')
  307.         out.write(_(u'STOP SEEDING'))
  308.         out.write(u'</span>\n                </div>\n                </div>\n                </a>\n            </div>')
  309.     out.write(u'\n        </div>\n        ')
  310.     if not (not (this.showMoreInfo)):
  311.         out.write(u'<div class="more-info-details">\n            <div>')
  312.         out.write(this.getMoreInfo())
  313.         out.write(u'</div>\n        </div>')
  314.     out.write(u'\n    </div>\n')
  315.     out.write(u'\n        ')
  316.     out.write(u'\n    <div class="main-video-desc noselect">\n        <h1 class="noselect">')
  317.     out.write(escape(this.getTitle()))
  318.     out.write(u'</h1>\n        <div class="main-video-desc-desc noselect">\n            <span>')
  319.     out.write(this.getDescription())
  320.     out.write(u'</span>\n        </div>\n        <div class="main-video-bottom">\n                <div class="channel-title">\n                        <span>')
  321.     out.write(escape(this.getChannelTitle()))
  322.     out.write(u'</span>\n                </div>\n                <div class="donate-html noselect">\n                    <span>')
  323.     out.write(this.getPaymentHTML())
  324.     out.write(u'</span>\n                </div>\n        </div>\n    </div>\n')
  325.     out.write(u'\n        <div class="clear"></div>\n    </body>\n</html>')
  326.     out.seek(0)
  327.  
  328.  
  329.     return (out, handle)
  330.